<h2>Søg</h2> 	    
<form name="text" method="get" action="material.php<?php echo isset($_GET["filt"])? "?filt=".$_GET["filt"]:"" ?>" >	    	
    <table>
		<tr>
   			<td>
   				<input type="text" name="q_na" placeholder="Materiale navn">
			</td>										
		</tr>
        <tr>	            
            <td>
            	<select name="q_me">
            		<option value="">Medier</option>            	
					<?php 
	                $media= $db ->query("SELECT * FROM media;");
	            	while($result = $media -> fetch_assoc()){
	    				echo'<option value="'.$result["MediaId"].'"> 
								'.htmlspecialchars($result["MediaName"]).'
							</option>';
					}  								
					?>
				</select>
			</td>			
		</tr>
       	<tr>
          	<td><b>Genre: </b></td>
    		<?php
    			$genres= $db ->query("SELECT * FROM genre;");
    			while($result=$genres->fetch_assoc()){
    				echo '<tr>
    						<td>
    							'.htmlspecialchars($result["GenreName"]).'
    						</td>
    						<td>
    							<input type="checkbox" name="q_ge[]"  value="'.$result["GenreId"].'" >
    						</td>
    					  </tr>';
    			}
                if(!$genres->num_rows>0){
                    echo'<td>
                            Ingen genre
                         <td>'; 
                }
    		 ?>
		</tr>
		<tr>
	   		<table>
  				<tr>
		    		<th></td>
	    			<td><b>År</b></td>
		    		<td></td>
		    		<th>Måned</td>
		    		<td></td>
		    		<th>Dag</th>
		    	</tr>
		      
		    	<tr>
		    		<td><b>Fra:</b></td>
		    		<td><input type="text" name="q_sd[]" placeholder="År" maxlength="4"></td>
		    		<td>-</td>
		    		<td>
		    			<select name="q_sd[]" >
		    				<?php 
		    					$value= 1;
		    					while($value<=12){
		    						echo '<option>'.$value.'</option>';
		    						$value ++;
		    					}
		    				?>
		                </select>
		    		</td>
		                 
		            <td>-</td>
		            <td>
		    			<select name="q_sd[]">
		    				<?php
		    					$value= 1;
		    					while($value<=31){
		    						echo '<option>'.$value.'</option>';
		    						$value ++;
		    					}
		    				?>
		    			</select>
		            </td>
		    	</tr>
		    
		            <tr>
		            <td><b>Til:</b></td>
		            <td><input type="text" name="q_ed[]" placeholder="År" maxlength="4"></td>
		                <td>-</td>
		             <td>
		                <select name="q_ed[]" >
		                    <?php 
		                        $value= 1;
		                        while($value<=12){
		                            echo '<option>'.$value.'</option>';
		                            $value ++;
		                        }
		                    ?>
		                </select>
		            </td>
		                 
		            <td>-</td>
		            <td>
		                <select name="q_ed[]">
		                    <?php
		                        $value= 1;
		                        while($value<=31){
		                            echo '<option>'.$value.'</option>';
		                            $value ++;
		                        }
		                    ?>
		                </select>
		            </td>
		        </tr>      
       		 </table>
   			 <td>
             	<input type="submit" name="search" value="Søg"/>
             </td>
     	</tr>
 	</table>
</form>
<script src="../Javascript/search.js"></script>